/*
 * =====================================================================================
 *
 *       Filename:  kill.c
 *
 *    Description:  demo of kill method.
 *
 *        Version:  1.0
 *        Created:  04/16/2012 02:55:24 PM
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  Zhiyi Wu (Z.W), zhiyiw@uoregon.edu
 *        Company:  University of Oregon
 *
 * =====================================================================================
 */

#include	"stdio.h"
#include<unistd.h>
#include<signal.h>
#include<sys/types.h>
#include<sys/wait.h>
main()
{
	pid_t pid;
	int status;
	if(!(pid= fork())){
		printf("Hi I am child process!\n");
		sleep(10);
		return;
	}
	else{
		printf("send signal to child process (%d) \n",pid);
		sleep(5);
		kill(pid ,SIGABRT);
		wait(&status);
		if(WIFSIGNALED(status))
			printf("chile process receive signal %d\n",WTERMSIG(status));
}
}
